package com.nzw.service.impl.index;

import com.nzw.pojo.index.Banner;
import com.nzw.service.impl.common.BaseServiceImpl;
import com.nzw.service.index.BannerService;
import com.nzw.vo.common.HttpResult;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;



@Service
public class BannerServiceImpl extends BaseServiceImpl implements BannerService{

	@Override
	public Banner findBannerById(Long id) {

		return getEntityById(id,Banner.class);
	}

	@Override
	public HttpResult getBannherByShopId(Long shopId) {
		
		Map<String,	Object> map = new HashMap<String,Object>();
		map.put("shopId", shopId);
		map.put("del",false);
		return new HttpResult(HttpResult.OK,getEntityByMap(Banner.class, map));
	}
	
	
	@Override
	public HttpResult getBannerById(Long id) {
		
		return new HttpResult(HttpResult.OK,getEntityById(id, Banner.class));
	}


	@Override
	public HttpResult addBanner(Banner banner) {
		
		return new HttpResult(HttpResult.OK,addEntity(banner));
	}


	@Override
	public HttpResult delBanner(Long id) {
		
		return new HttpResult(HttpResult.OK,deleteEntityById(id, Banner.class));
	}


	@Override
	public HttpResult update(Banner banner) {
		
		return new HttpResult(HttpResult.OK,updateEntityValues(banner));
	}

}
